tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2
authorBen Hutchings <ben@decadent.org.uk>
Tue, 11 Sep 2018 01:38:36 +0000 (02:38 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Sun, 30 Dec 2018 09:04:03 +0000 (09:04 +0000)
commita0f471d6a22836680312feb52c7642167e4cd361
tree7413bf7257ce023aa6d17b1e95515159271c5270
parent2db8ac19c320ea47949b329785a452a6bb52dfee
tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2

x86_energy_perf_policy first uses __get_cpuid() to check the maximum
CPUID level and exits if it is too low.  It then assumes that later
calls will succeed (which I think is architecturally guaranteed).  It
also assumes that CPUID works at all (which is not guaranteed on
x86_32).

If optimisations are enabled, gcc warns about potentially
uninitialized variables.  Fix this by adding an exit-on-error after
every call to __get_cpuid() instead of just checking the maximum
level.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-x86_energy_perf_policy-fix-uninitialized-varia.patch
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c